@extends('layouts.app', ['active' => 4])
@section('title')打印人员列表 -
@endsection
@section('content')

            <div class="panel panel-default">
                <div class="panel-heading">
                    <i class="fa fa-align-justify"></i> 人员列表打印
                    <a  href="#" id="list_print"><i class="fa fa-print" aria-hidden="true"></i> 打印 ( 请选择横向打印 )</a>
                    @include('person.menu')
                </div>
                <div class="panel-body" id="person_list">

                 <div style="text-align:right;padding:0 0 10px">
                     到我市时间从@if (! empty($filter['start_time'])){{ $filter['start_time'] }}@else 开始@endif，到@if (! empty($filter['end_time'])){{  $filter['end_time'] }}@else 结束@endif, 共 <strong>{{$persons->count()}} </strong>人
                 </div>
                  <table class="table table-hover " style="border:1px solid #ddd">
                        <thead class="">
                          <tr>
                            <th>照片</th>
                            <th>姓名</th>
                              <th>本</th>
                            <th>身份证</th>
                            <th>户籍地</th>
                            <th>到我市时间</th>
                            <th>手机号</th>
                          </tr>
                        </thead>
                        <tbody>
                          @foreach ($persons as $person)
                          <tr>
                            <td><img src="{{ url('/') }}/@if ($person->avatar != ''){{ $person->avatar }}@else{{  'img/avatar_default.png' }}@endif" style="height:50px;width:50px" class="img-thumbnail"  class="img-circle" alt="{{ $person->name }}"></td>
                            <td>{{ $person->name }}</td>
                              <td>@if ($person->is_the_city == 1) 是 @else 否@endif</td>
                            <td>{{ $person->id_number }}</td>
                            <td>{{ $person->reg_addr }}</td>
                              <td>{{ $person->five_saw_time==0?'已离开':date('Y-m-d', $person->five_saw_time) }}</td>
                            <td>{{ $person->phone }}</td>
                          </tr>
                          @endforeach
                        </tbody>
                      </table>
                </div>
            </div>


<div class="modal fade" tabindex="-1" role="dialog" id="delete_modal">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">确认</h4>
      </div>
      <div class="modal-body">
        <p class="text-center">确认删除吗?</p>
      </div>
      <div class="modal-footer">
        <form action="" method="POST" style="display: inline;" id="model_form">
                                    {{ method_field('DELETE') }}
                                    {{ csrf_field() }}
                                    <button type="submit" class="btn btn-primary">是</button>
                                    <button type="button" class="btn btn-default" data-dismiss="modal">否</button>

        </form>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
@endsection

@section('script')
    <script src="{{ asset('js/jquery.min.js') }}"></script>
    <script src="{{ asset('print/jQuery.print.js') }}"></script>
    <script type='text/javascript'>
        //<![CDATA[
        jQuery(function($) { 'use strict';

            $("#list_print").on('click', function() {
                //Print ele4 with custom options
                $("#person_list").print({
                    //Use Global styles
                    globalStyles : true,
                    //Add link with attrbute media=print
                    mediaPrint : false,
                    //Custom stylesheet

                    //Print in a hidden iframe
                    iframe : false,
                    //Don't print this
                    noPrintSelector : ".avoid-this",
                    //Add this at top
                    prepend : "",
                    //Add this on bottom
                    append : "",
                    //Log to console when printing is done via a deffered callback
                    deferred: $.Deferred().done(function() { console.log('Printing done', arguments); })
                });
            });
            // Fork https://github.com/sathvikp/jQuery.print for the full list of options
            $("#list_print").click();
        });
        //]]>

    </script>



@endsection
